<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<#include "/common/resources.ftl"/>
<script type="text/javascript">
	$(function(){
		window.m_datagrid = $('#m_datagrid').datagrid({
			url:'${ctx}/channel/companyrelation/listCN',
			onLoadSuccess:yixun.closeProgress,
			onBeforeLoad:yixun.progress,
			queryParams:$('#load_list_search').serializeObject(),
			loadMsg:null,
			singleSelect:true,
			fitColumns:true,
			rownumbers:true,
			pagination:true,
			border:'false',
			toolbar:'#m_toolbar'
		});
	
		//按条件查询用户
		window.searchData = function () {
			m_datagrid.datagrid('load',$('#load_list_search').serializeObject());
		}
		
		//删除
		window.deleteDate = function(mid){
			$.messager.confirm('确认!','你确定要删除此数据吗?',function(res){
				if(res){
					$.post("${ctx}/channel/companyrelation/del",{'id':mid},function(result){
						if (result.errorMsg){
							$.messager.show({
								title: '友情提示',
								msg: 'result.errorMsg'
							});
							m_datagrid.datagrid('reload');
						} else {
							$.messager.show({
								title: '友情提示',
								msg: '删除成功'
							});
						}
					},'json');
				}
			});
		}
	});
	mShowButton = function (value,row,index){
		var btns = [];
		btns.push('<button class="green_btn" onclick="javascript:deleteDate('+value+');void(0);">删除</button>');
		btns.push('<button class="green_btn" onclick="javascript:window.location.href=\'view?id='+value+'\';void(0);">编辑</button>');
		return btns.join('');
	}
</script>
</head>
<body style="background-color:white;">

<div id="m_toolbar" class="datagrid-toolbar" style="overflow: hidden;height: auto;margin: 15px 0px;background-color: white;border-bottom: none;" border="false">
  <form id="load_list_search" onsubmit="return false;">
  <div class="fm_sty" style="margin: 20px 0px 0px;">
   	<div class="ipt_line">
	<span class="ipt_title">开发商</span>
		<input type="text" name="devCompanyName" class="ipt_226" />
	</div>
   	<div class="ipt_line">
	<span class="ipt_title">代理公司</span>
		<input type="text" name="agentCompanyName" class="ipt_226" />
	</div>
	<div class="ipt_line_long">
        <button class="red_100" onclick="searchData()">查询</button>
	</div>    
  </div>
  </form>
</div>

<!-- 查找结果 -->
<table style="margin:0px 20px;" id="m_datagrid">
	<thead>
		<tr>
			<th field="devCompanyName" width="60" height="40" >开发商</th>
			<th field="agentCompanyName" width="60" height="40" >代理公司</th>
			<th data-options="field:'relationStatus',formatter:function(value,row,index){var key = 'RelationStatus';return yixun.combobox_formatter(value,row,index,key);}" width="60" height="40" >合作关系</th>
			<th field="createTime" width="60" height="40" >创建时间</th>
		</tr>
	</thead>
</table>

</body>
</html>
